/*
 * WeightFormatException.java
 *
 * Copyright (C) 2014 Fabian Wenzelmann
 *
 * This file is part of stura_voting.
 *
 * stura_voting is free software: you
 * can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * stura_voting is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with stura_voting.
 *
 * If not, see <http://www.gnu.org/licenses/>.
 */

package de.stura;

/**
 * An exception that is thrown if WeightedVoter objects are formated in
 * the wrong way.
 */
public class WeightFormatException extends Exception {
    /**
     * Constructor.
     * 
     * @param lineNum The line number in which the error occurred.
     * @param line The wrong formatted line.
     * @param explanation A text explaining the error.
     * @param cause The cause of the expcetion.
     */
    public WeightFormatException(int lineNum, String line, String explanation, Throwable cause) {
        super("Wrong format in line " + lineNum + "\n\t" + line + "\nError: " + explanation, cause);
    }
    
    /**
     * Constructor.
     * 
     * @param lineNum The line number in which the error occurred.
     * @param line The wrong formatted line.
     * @param explanation A text explaining the error.
     */
    public WeightFormatException(int lineNum, String line, String explanation) {
        this(lineNum, line, explanation, null);
    }

}
